<?php
/**
 * Created by PhpStorm.
 * User: luo
 * Date: 2018/11/11
 * Time: 23:54
 */

namespace app\models\traits;


trait Time
{
    public function showTimeArt(){
        $weeks = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
        $other_weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        return [
            'month' => date('M', $this->created_at),
            'day'   => date('d', $this->created_at),
			'year'  => date('Y', $this->created_at),
			'little_month' => date('m', $this->created_at),
			'other_week' => $other_weeks[date('w', $this->created_at)],
            'week'  => $weeks[date('w', $this->created_at)]
        ];
    }

    public function showHasWeek(){
        $weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        return date('y-m-d',$this->created_at).'·'.$weeks[date('w', $this->created_at)];
    }
}